package com.truesai.entities.price;

import java.math.BigDecimal;
import java.sql.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;

import com.truesai.entities.production.Production;

/**
 * 产品进价快照<strong>决策分析</strong><br/>
 * 需求分析<br/>
 * <strong>唯一性:</strong>产品id，快照日期
 * @author XuLian
 *
 */
@Entity
@NamedQueries(
{
        @NamedQuery(name = InPriceSnapshot.ALL, query = "Select ips from InPriceSnapshot ips"),
        @NamedQuery(name = InPriceSnapshot.BY_MARK_ID, query = "Select ips from InPriceSnapshot ips where ips.production = :production"),
        @NamedQuery(name = InPriceSnapshot.BY_ID, query = "Select ips from InPriceSnapshot ips where ips.id = :id") })
@Table(name = "InPrices_snapshot")
public class InPriceSnapshot {
	public static final String ALL = "InPriceSnapshot.all";

    public static final String BY_MARK_ID = "InPriceSnapshot.byProductionId";

    public static final String BY_ID = "InPriceSnapshot.byId";
    
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;
    
    /**产品*/
    @ManyToOne
    private Production production;
    
    /**产品进价*/
    @Column(scale=2)
    private BigDecimal inPrice;
    
    /**日期*/
    @Column
    private Date snapshotDate;
    
    public InPriceSnapshot() { }
    
    public InPriceSnapshot(Production production, BigDecimal inPrice, Date snapshotDate) {
    	this.production = production;
    	this.inPrice = inPrice;
    	this.snapshotDate = snapshotDate;
    }

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public Production getProduction() {
		return production;
	}

	public void setProduction(Production production) {
		this.production = production;
	}

	public BigDecimal getInPrice() {
		return inPrice;
	}

	public void setInPrice(BigDecimal inPrice) {
		this.inPrice = inPrice;
	}

	public Date getSnapshotDate() {
		return snapshotDate;
	}

	public void setSnapshotDate(Date snapshotDate) {
		this.snapshotDate = snapshotDate;
	}
	

}
